package com.shanzmoo.db.domain.vo;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.shanzmoo.db.module.psys.entity.PSysUserEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 *
 *
 * @author： Gzhao 2021/3/29
 */
@Data
@ApiModel(value="系统用户分页对象")
public class UserPageVo {

    @ApiModelProperty("用户ID" )
    private Integer id;

    @ApiModelProperty("用户名称" )
    private String username;

    @ApiModelProperty(value = "用户角色id拼接字符串")
    private String roleIds;

    @ApiModelProperty("用户角色" )
    private String roleNames;

    @ApiModelProperty("状态：1-启用，2-禁用" )
    private Boolean status;

    @ApiModelProperty("创建人" )
    private String createUser;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("创建时间" )
    private LocalDateTime createTime;

    public static UserPageVo create(PSysUserEntity userEntity) {
        return JSON.parseObject(JSON.toJSONString(userEntity), UserPageVo.class);
    }
}
